using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._ProjectionsandTransformations._Raster
{
    /// <summary>
    /// <para>Warp</para>
    /// <para>Transforms a raster dataset using source and target control points. This is similar to georeferencing.</para>
    /// <para>使用源控制点和目标控制点变换栅格数据集。这类似于地理配准。</para>
    /// </summary>    
    [DisplayName("Warp")]
    public class Warp : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Warp()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input Raster</para>
        /// <para>The raster to be transformed.</para>
        /// <para>要变换的栅格。</para>
        /// </param>
        /// <param name="_source_control_points">
        /// <para>Source Control Points</para>
        /// <para>The coordinates of the raster to be warped.</para>
        /// <para>要变形的栅格的坐标。</para>
        /// </param>
        /// <param name="_target_control_points">
        /// <para>Target Control Points</para>
        /// <para>The coordinates to which the source raster will be warped.</para>
        /// <para>源栅格将变形到的坐标。</para>
        /// </param>
        /// <param name="_out_raster">
        /// <para>Output Raster Dataset</para>
        /// <para><xdoc>
        ///   <para>The name, location, and format for the dataset you are creating. When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. When storing your raster dataset to a JPEG file, JPEG 2000 file, TIFF file, or geodatabase, you can specify a compression type and compression quality.</para>
        ///   <para>When storing the raster dataset in a file format, you need to specify the file extension:</para>
        ///   <bulletList>
        ///     <bullet_item>.bil—Esri BIL</bullet_item><para/>
        ///     <bullet_item>.bip—Esri BIP</bullet_item><para/>
        ///     <bullet_item>.bmp—BMP</bullet_item><para/>
        ///     <bullet_item>.bsq—Esri BSQ</bullet_item><para/>
        ///     <bullet_item>.dat—ENVI DAT</bullet_item><para/>
        ///     <bullet_item>.gif—GIF</bullet_item><para/>
        ///     <bullet_item>.img—ERDAS IMAGINE</bullet_item><para/>
        ///     <bullet_item>.jpg—JPEG</bullet_item><para/>
        ///     <bullet_item>.jp2—JPEG 2000</bullet_item><para/>
        ///     <bullet_item>.png—PNG</bullet_item><para/>
        ///     <bullet_item>.tif—TIFF</bullet_item><para/>
        ///     <bullet_item>.mrf—MRF</bullet_item><para/>
        ///     <bullet_item>.crf—CRF</bullet_item><para/>
        ///     <bullet_item>No extension for Esri Grid</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要创建的数据集的名称、位置和格式。在地理数据库中存储栅格数据集时，请勿在栅格数据集的名称中添加文件扩展名。将栅格数据集存储为 JPEG 文件、JPEG 2000 文件、TIFF 文件或地理数据库时，可以指定压缩类型和压缩质量。</para>
        ///   <para>以文件格式存储栅格数据集时，需要指定文件扩展名：</para>
        ///   <bulletList>
        ///     <bullet_item>.bil - Esri BIL</bullet_item><para/>
        ///     <bullet_item>.bip - Esri BIP</bullet_item><para/>
        ///     <bullet_item>.bmp—BMP</bullet_item><para/>
        ///     <bullet_item>.bsq—Esri BSQ</bullet_item><para/>
        ///     <bullet_item>.dat—ENVI DAT</bullet_item><para/>
        ///     <bullet_item>.gif—GIF</bullet_item><para/>
        ///     <bullet_item>.img—ERDAS 想象</bullet_item><para/>
        ///     <bullet_item>.jpg - JPEG</bullet_item><para/>
        ///     <bullet_item>.jp2 - JPEG 2000</bullet_item><para/>
        ///     <bullet_item>.png—PNG</bullet_item><para/>
        ///     <bullet_item>.tif—TIFF</bullet_item><para/>
        ///     <bullet_item>.mrf - MRF</bullet_item><para/>
        ///     <bullet_item>.crf - CRF</bullet_item><para/>
        ///     <bullet_item>没有 Esri Grid 的扩展模块</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public Warp(object _in_raster, List<object> _source_control_points, List<object> _target_control_points, object _out_raster)
        {
            this._in_raster = _in_raster;
            this._source_control_points = _source_control_points;
            this._target_control_points = _target_control_points;
            this._out_raster = _out_raster;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Warp";

        public override string CallName => "management.Warp";

        public override List<string> AcceptEnvironments => ["compression", "configKeyword", "extent", "geographicTransformations", "nodata", "outputCoordinateSystem", "parallelProcessingFactor", "pyramid", "rasterStatistics", "resamplingMethod", "scratchWorkspace", "snapRaster", "tileSize", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _source_control_points, _target_control_points, _out_raster, _transformation_type.GetGPValue(), _resampling_type.GetGPValue()];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para>The raster to be transformed.</para>
        /// <para>要变换的栅格。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Source Control Points</para>
        /// <para>The coordinates of the raster to be warped.</para>
        /// <para>要变形的栅格的坐标。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Source Control Points")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _source_control_points { get; set; }


        /// <summary>
        /// <para>Target Control Points</para>
        /// <para>The coordinates to which the source raster will be warped.</para>
        /// <para>源栅格将变形到的坐标。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Target Control Points")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _target_control_points { get; set; }


        /// <summary>
        /// <para>Output Raster Dataset</para>
        /// <para><xdoc>
        ///   <para>The name, location, and format for the dataset you are creating. When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. When storing your raster dataset to a JPEG file, JPEG 2000 file, TIFF file, or geodatabase, you can specify a compression type and compression quality.</para>
        ///   <para>When storing the raster dataset in a file format, you need to specify the file extension:</para>
        ///   <bulletList>
        ///     <bullet_item>.bil—Esri BIL</bullet_item><para/>
        ///     <bullet_item>.bip—Esri BIP</bullet_item><para/>
        ///     <bullet_item>.bmp—BMP</bullet_item><para/>
        ///     <bullet_item>.bsq—Esri BSQ</bullet_item><para/>
        ///     <bullet_item>.dat—ENVI DAT</bullet_item><para/>
        ///     <bullet_item>.gif—GIF</bullet_item><para/>
        ///     <bullet_item>.img—ERDAS IMAGINE</bullet_item><para/>
        ///     <bullet_item>.jpg—JPEG</bullet_item><para/>
        ///     <bullet_item>.jp2—JPEG 2000</bullet_item><para/>
        ///     <bullet_item>.png—PNG</bullet_item><para/>
        ///     <bullet_item>.tif—TIFF</bullet_item><para/>
        ///     <bullet_item>.mrf—MRF</bullet_item><para/>
        ///     <bullet_item>.crf—CRF</bullet_item><para/>
        ///     <bullet_item>No extension for Esri Grid</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要创建的数据集的名称、位置和格式。在地理数据库中存储栅格数据集时，请勿在栅格数据集的名称中添加文件扩展名。将栅格数据集存储为 JPEG 文件、JPEG 2000 文件、TIFF 文件或地理数据库时，可以指定压缩类型和压缩质量。</para>
        ///   <para>以文件格式存储栅格数据集时，需要指定文件扩展名：</para>
        ///   <bulletList>
        ///     <bullet_item>.bil - Esri BIL</bullet_item><para/>
        ///     <bullet_item>.bip - Esri BIP</bullet_item><para/>
        ///     <bullet_item>.bmp—BMP</bullet_item><para/>
        ///     <bullet_item>.bsq—Esri BSQ</bullet_item><para/>
        ///     <bullet_item>.dat—ENVI DAT</bullet_item><para/>
        ///     <bullet_item>.gif—GIF</bullet_item><para/>
        ///     <bullet_item>.img—ERDAS 想象</bullet_item><para/>
        ///     <bullet_item>.jpg - JPEG</bullet_item><para/>
        ///     <bullet_item>.jp2 - JPEG 2000</bullet_item><para/>
        ///     <bullet_item>.png—PNG</bullet_item><para/>
        ///     <bullet_item>.tif—TIFF</bullet_item><para/>
        ///     <bullet_item>.mrf - MRF</bullet_item><para/>
        ///     <bullet_item>.crf - CRF</bullet_item><para/>
        ///     <bullet_item>没有 Esri Grid 的扩展模块</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Raster Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_raster { get; set; }


        /// <summary>
        /// <para>Transformation Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the transformation method for shifting the raster dataset.</para>
        ///   <bulletList>
        ///     <bullet_item>Shift only— This method uses a zero-order polynomial to shift your data. This is commonly used when your data is already georeferenced, but a small shift will better line up your data. Only one link is required to perform a zero-order polynomial shift.</bullet_item><para/>
        ///     <bullet_item>Similarity transformation— This is a first order transformation that attempts to preserve the shape of the original raster. The RMS error tends to be higher than other polynomial transformations because the preservation of shape is more important than the best fit.</bullet_item><para/>
        ///     <bullet_item>Affine transformation—A first-order polynomial (affine) fits a flat plane to the input points.</bullet_item><para/>
        ///     <bullet_item>Second-order polynomial transformation—A second-order polynomial fits a somewhat more complicated surface to the input points.</bullet_item><para/>
        ///     <bullet_item>Third-order polynomial transformation—A third-order polynomial fits a more complicated surface to the input points.</bullet_item><para/>
        ///     <bullet_item>Optimize for global and local accuracy— This method combines a polynomial transformation and uses a triangulated irregular network (TIN) interpolation technique to optimize for both global and local accuracy.</bullet_item><para/>
        ///     <bullet_item>Spline transformation— This method transforms the source control points precisely to the target control points. In the output, the control points will be accurate, but the raster pixels between the control points are not.</bullet_item><para/>
        ///     <bullet_item>Projective transformation— This method warps lines so they remain straight. In doing so, lines that were once parallel may no longer remain parallel. The projective transformation is especially useful for oblique imagery, scanned maps, and for some imagery products.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定用于移动栅格数据集的变换方法。</para>
        ///   <bulletList>
        ///     <bullet_item>仅移位 — 此方法使用零阶多项式来移位数据。当您的数据已经进行了地理配准时，通常会使用此方法，但较小的偏移将更好地排列数据。只需一个链路即可执行零阶多项式移位。</bullet_item><para/>
        ///     <bullet_item>相似性变换 - 这是尝试保留原始栅格形状的一阶变换。RMS 误差往往高于其他多项式变换，因为形状的保持比最佳拟合更重要。</bullet_item><para/>
        ///     <bullet_item>仿射变换 - 一阶多项式（仿射）将平面拟合到输入点。</bullet_item><para/>
        ///     <bullet_item>二阶多项式变换 - 二阶多项式将稍微复杂的曲面拟合到输入点。</bullet_item><para/>
        ///     <bullet_item>三阶多项式变换 - 三阶多项式将更复杂的曲拟合到输入点。</bullet_item><para/>
        ///     <bullet_item>优化全局和局部精度 — 此方法结合了多项式变换，并使用三角不规则网络 （TIN） 插值技术来优化全局和局部精度。</bullet_item><para/>
        ///     <bullet_item>样条变换 — 此方法将源控制点精确地转换为目标控制点。在输出中，控制点将准确，但控制点之间的栅格像素则不准确。</bullet_item><para/>
        ///     <bullet_item>投影变换 - 此方法使线变形，使其保持笔直。这样一来，曾经平行的线可能不再保持平行。投影变换对于倾斜影像、扫描地图和某些影像产品特别有用。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Transformation Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _transformation_type_value _transformation_type { get; set; } = _transformation_type_value._POLYORDER1;

        public enum _transformation_type_value
        {
            /// <summary>
            /// <para>Shift only</para>
            /// <para>Shift only— This method uses a zero-order polynomial to shift your data. This is commonly used when your data is already georeferenced, but a small shift will better line up your data. Only one link is required to perform a zero-order polynomial shift.</para>
            /// <para>仅移位 — 此方法使用零阶多项式来移位数据。当您的数据已经进行了地理配准时，通常会使用此方法，但较小的偏移将更好地排列数据。只需一个链路即可执行零阶多项式移位。</para>
            /// </summary>
            [Description("Shift only")]
            [GPEnumValue("POLYORDER0")]
            _POLYORDER0,

            /// <summary>
            /// <para>Similarity transformation</para>
            /// <para>Similarity transformation— This is a first order transformation that attempts to preserve the shape of the original raster. The RMS error tends to be higher than other polynomial transformations because the preservation of shape is more important than the best fit.</para>
            /// <para>相似性变换 - 这是尝试保留原始栅格形状的一阶变换。RMS 误差往往高于其他多项式变换，因为形状的保持比最佳拟合更重要。</para>
            /// </summary>
            [Description("Similarity transformation")]
            [GPEnumValue("POLYSIMILARITY")]
            _POLYSIMILARITY,

            /// <summary>
            /// <para>Affine transformation</para>
            /// <para>Affine transformation—A first-order polynomial (affine) fits a flat plane to the input points.</para>
            /// <para>仿射变换 - 一阶多项式（仿射）将平面拟合到输入点。</para>
            /// </summary>
            [Description("Affine transformation")]
            [GPEnumValue("POLYORDER1")]
            _POLYORDER1,

            /// <summary>
            /// <para>Second-order polynomial transformation</para>
            /// <para>Second-order polynomial transformation—A second-order polynomial fits a somewhat more complicated surface to the input points.</para>
            /// <para>二阶多项式变换 - 二阶多项式将稍微复杂的曲面拟合到输入点。</para>
            /// </summary>
            [Description("Second-order polynomial transformation")]
            [GPEnumValue("POLYORDER2")]
            _POLYORDER2,

            /// <summary>
            /// <para>Third-order polynomial transformation</para>
            /// <para>Third-order polynomial transformation—A third-order polynomial fits a more complicated surface to the input points.</para>
            /// <para>三阶多项式变换 - 三阶多项式将更复杂的曲拟合到输入点。</para>
            /// </summary>
            [Description("Third-order polynomial transformation")]
            [GPEnumValue("POLYORDER3")]
            _POLYORDER3,

            /// <summary>
            /// <para>Optimize for global and local accuracy</para>
            /// <para>Optimize for global and local accuracy— This method combines a polynomial transformation and uses a triangulated irregular network (TIN) interpolation technique to optimize for both global and local accuracy.</para>
            /// <para>优化全局和局部精度 — 此方法结合了多项式变换，并使用三角不规则网络 （TIN） 插值技术来优化全局和局部精度。</para>
            /// </summary>
            [Description("Optimize for global and local accuracy")]
            [GPEnumValue("ADJUST")]
            _ADJUST,

            /// <summary>
            /// <para>Spline transformation</para>
            /// <para>Spline transformation— This method transforms the source control points precisely to the target control points. In the output, the control points will be accurate, but the raster pixels between the control points are not.</para>
            /// <para>样条变换 — 此方法将源控制点精确地转换为目标控制点。在输出中，控制点将准确，但控制点之间的栅格像素则不准确。</para>
            /// </summary>
            [Description("Spline transformation")]
            [GPEnumValue("SPLINE")]
            _SPLINE,

            /// <summary>
            /// <para>Projective transformation</para>
            /// <para>Projective transformation— This method warps lines so they remain straight. In doing so, lines that were once parallel may no longer remain parallel. The projective transformation is especially useful for oblique imagery, scanned maps, and for some imagery products.</para>
            /// <para>投影变换 - 此方法使线变形，使其保持笔直。这样一来，曾经平行的线可能不再保持平行。投影变换对于倾斜影像、扫描地图和某些影像产品特别有用。</para>
            /// </summary>
            [Description("Projective transformation")]
            [GPEnumValue("PROJECTIVE")]
            _PROJECTIVE,

        }

        /// <summary>
        /// <para>Resampling Technique</para>
        /// <para><xdoc>
        ///   <para>The resampling algorithm to be used. The default is Nearest.</para>
        ///   <bulletList>
        ///     <bullet_item>Nearest neighbor— Nearest neighbor is the fastest resampling method; it minimizes changes to pixel values since no new values are created. It is suitable for discrete data, such as land cover.</bullet_item><para/>
        ///     <bullet_item>Bilinear interpolation— Bilinear interpolation calculates the value of each pixel by averaging (weighted for distance) the values of the surrounding four pixels. It is suitable for continuous data.</bullet_item><para/>
        ///     <bullet_item>Cubic convolution— Cubic convolution calculates the value of each pixel by fitting a smooth curve based on the surrounding 16 pixels. This produces the smoothest image but can create values outside of the range found in the source data. It is suitable for continuous data.</bullet_item><para/>
        ///     <bullet_item>Majority resampling—Majority resampling determines the value of each pixel based on the most popular value in a 3 by 3 window. Suitable for discrete data.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>The Nearest and Majority options are used for categorical data, such as a land-use classification. The Nearest option is the default since it is the quickest and also because it will not change the cell values. Do not use either of these for continuous data, such as elevation surfaces.</para>
        ///   <para>The Bilinear option and the Cubic option are most appropriate for continuous data. It is recommended that neither of these be used with categorical data because the cell values may be altered.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要使用的重采样算法。默认值为“最近”。</para>
        ///   <bulletList>
        ///     <bullet_item>最近邻 - 最近邻是最快的重采样方法;它最大限度地减少了对像素值的更改，因为不会创建新值。它适用于离散数据，例如土地覆盖。</bullet_item><para/>
        ///     <bullet_item>双线性插值 — 双线性插值通过对周围四个像素的值进行平均（按距离加权）来计算每个像素的值。它适用于连续数据。</bullet_item><para/>
        ///     <bullet_item>三次卷积— 三次卷积通过基于周围 16 个像素拟合平滑曲线来计算每个像素的值。这将生成最平滑的图像，但可能会创建源数据中查找范围之外的值。它适用于连续数据。</bullet_item><para/>
        ///     <bullet_item>多数重采样 - 多数重采样根据 3 x 3 窗口中最常用的值确定每个像素的值。适用于离散数据。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>“最近”和“多数”选项用于分类数据，例如土地利用分类。“最近”选项是默认选项，因为它是最快的选项，并且因为它不会更改单元格值。请勿将其中任何一个用于连续数据，例如高程表面。</para>
        ///   <para>“双线性”选项和“立方”选项最适合连续数据。建议将这两者都不用于分类数据，因为单元格值可能会更改。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Resampling Technique")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _resampling_type_value _resampling_type { get; set; } = _resampling_type_value._NEAREST;

        public enum _resampling_type_value
        {
            /// <summary>
            /// <para>Nearest neighbor</para>
            /// <para>Nearest neighbor— Nearest neighbor is the fastest resampling method; it minimizes changes to pixel values since no new values are created. It is suitable for discrete data, such as land cover.</para>
            /// <para>最近邻 - 最近邻是最快的重采样方法;它最大限度地减少了对像素值的更改，因为不会创建新值。它适用于离散数据，例如土地覆盖。</para>
            /// </summary>
            [Description("Nearest neighbor")]
            [GPEnumValue("NEAREST")]
            _NEAREST,

            /// <summary>
            /// <para>Bilinear interpolation</para>
            /// <para>Bilinear interpolation— Bilinear interpolation calculates the value of each pixel by averaging (weighted for distance) the values of the surrounding four pixels. It is suitable for continuous data.</para>
            /// <para>双线性插值 — 双线性插值通过对周围四个像素的值进行平均（按距离加权）来计算每个像素的值。它适用于连续数据。</para>
            /// </summary>
            [Description("Bilinear interpolation")]
            [GPEnumValue("BILINEAR")]
            _BILINEAR,

            /// <summary>
            /// <para>Cubic convolution</para>
            /// <para>Cubic convolution— Cubic convolution calculates the value of each pixel by fitting a smooth curve based on the surrounding 16 pixels. This produces the smoothest image but can create values outside of the range found in the source data. It is suitable for continuous data.</para>
            /// <para>三次卷积— 三次卷积通过基于周围 16 个像素拟合平滑曲线来计算每个像素的值。这将生成最平滑的图像，但可能会创建源数据中查找范围之外的值。它适用于连续数据。</para>
            /// </summary>
            [Description("Cubic convolution")]
            [GPEnumValue("CUBIC")]
            _CUBIC,

            /// <summary>
            /// <para>Majority resampling</para>
            /// <para>Majority resampling—Majority resampling determines the value of each pixel based on the most popular value in a 3 by 3 window. Suitable for discrete data.</para>
            /// <para>多数重采样 - 多数重采样根据 3 x 3 窗口中最常用的值确定每个像素的值。适用于离散数据。</para>
            /// </summary>
            [Description("Majority resampling")]
            [GPEnumValue("MAJORITY")]
            _MAJORITY,

        }

        public Warp SetEnv(object compression = null, object configKeyword = null, object extent = null, object geographicTransformations = null, object nodata = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object pyramid = null, object rasterStatistics = null, object resamplingMethod = null, object scratchWorkspace = null, object snapRaster = null, double[] tileSize = null, object workspace = null)
        {
            base.SetEnv(compression: compression, configKeyword: configKeyword, extent: extent, geographicTransformations: geographicTransformations, nodata: nodata, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, pyramid: pyramid, rasterStatistics: rasterStatistics, resamplingMethod: resamplingMethod, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, tileSize: tileSize, workspace: workspace);
            return this;
        }

    }

}